<div class="cl pd-5 bg-1 bk-gray"> 
	<span class="l"> 
		<a class="btn btn-primary radius" href="javascript:;" onclick="admin_role_add('添加活动','add.html','920', '600')"><i class="Hui-iconfont">&#xe600;</i> 添加活动</a> 
	</span>
	<span class="r">共有数据：<strong>{$count}</strong> 条</span>
</div>
<table class="table table-border table-bordered table-hover table-bg">
	<thead>
		<tr class="text-c">
			<th width="25">ID</th>
			<th>活动名称</th>
			<th>开始时间</th>
			<th>结束时间</th>
			<th>规则</th>
			<th>活动状态</th>
			<th>发布者</th>
			<th>发布时间</th>
			<th width="70">操作</th>
		</tr>
	</thead>
	<tbody>
		<?php if(is_array($list) && count($list)){ ?>
		<?php foreach($list as $ls){ ?>
			<?php $attrRow = count($ls['attr']); ?>
		<?php foreach($ls['attr'] as $k=>$attr){ ?>	
		<tr class="text-c">
			<?php if($k == 0){ ?>
			<td rowspan="{$attrRow}" width="40">{$ls['typeid']}</td>
			<td class="text-l" rowspan="{$attrRow}" width="200">{$ls['type_title']}</td>
			<td rowspan="{$attrRow}"><?php echo date('Y-m-d', $ls['type_btime']);?></td>
			<td rowspan="{$attrRow}"><?php echo date('Y-m-d', $ls['type_etime']);?></td>
			<?php } ?>
			<td class="text-l" width="300">{$attr['remark']}</td>
			<?php if($k == 0){ ?>
			<td rowspan="{$attrRow}">
				<span class="select-box radius" style="width: 70px">
				  	<select class="select mstatus" size="1" e_id="{$ls['typeid']}">
					  	<option value="1" <?php echo $ls['type_status'] == 1 ? 'selected' : ''; ?>>使用</option>
						<option value="2" <?php echo $ls['type_status'] == 2 ? 'selected' : ''; ?>>暂停</option>
					  	<option value="0" <?php echo $ls['type_status'] == 0 ? 'selected' : ''; ?>>失效</option>
				  	</select>
				</span>		
			</td>
			<td rowspan="{$attrRow}">{$ls['admin_nick']}</td>
			<td rowspan="{$attrRow}"><?php echo date('Y-m-d', $ls['createtime']);?></td>
			<td rowspan="{$attrRow}" class="f-14">
				<a title="编辑" href="javascript:;" onclick="admin_role_edit('活动编辑','add.html?typeid={$ls['typeid']}','1', '920', '600')" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
				<!--
				<a title="删除" href="javascript:;" onclick="admin_role_del(this,'{$ls['typeid']}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>-->
			</td>
			<?php } ?>
		</tr>
		<?php } ?>
		<?php } }else{ ?>
		<tr class="text-c">
			<td colspan="19" >暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<!--page-->
<include file="Common/page" />
<script>
	$(document).ready(function(){
		$(".mstatus").on('change', function(){
			var eventid = $(this).attr('e_id');
			var status = $(this).val();
			
			var load = layer.load(2);
			$.post('edit.html', {typeid: eventid, status: status}, function(row){
				layer.close(load);
				if(row/1){
					layer.msg('操作成功', {icon: 1, time: 2000});
				}else{
					layer.msg('操作失败', {icon: 2, time: 2000});
				}
			});
		});
	});
</script>